<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/><meta name="exporter-version" content="Evernote Mac 9.5.12 (464966)"/><meta name="author" content="704206198@qq.com"/><meta name="created" content="2017-10-17 06:19:00 +0000"/><meta name="source" content="desktop.mac"/><meta name="updated" content="2021-08-11 07:41:07 +0000"/><title>DAY16：面向对象编程</title></head><body><div><span style="font-size: 18px;">什么是面向对象？</span></div><div style="box-sizing: border-box; padding: 8px; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902);"><div><br/></div><div><span style="background-color: rgb(251, 250, 248);"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">    面向对象（Object Oriented，OO）是软件开发方法。面向对象的概念和应用已超越了程序设计和软件开发，扩展到如数据库系统，交互式界面，应用结构，应用平台，分布式系统，网络管理结构，CAD技术，人工智能等领域。面向对象是一种对现实世界理解和抽象的方法，是计算机编程技术发展到一定阶段后到产物，是一种高级的编程思想。</span></span></div><div><br/></div><div><span style="background-color: rgb(251, 250, 248);"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">    </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">面向对象就是一种新的编程模式。</span></span></div><div><br/></div><div><span style="background-color: rgb(251, 250, 248);"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">    面向过程？把所有的功能都写在一起，逐行实现</span></span></div><div><br/></div><div><span style="background-color: rgb(251, 250, 248);"><span style="background-color: rgb(251, 250, 248);"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">    面向对象在其它编程语言中普遍使用，Java，PHP，Python</span></span></span></div><div><span style="background-color: rgb(251, 250, 248);"><span style="background-color: rgb(251, 250, 248);"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">    </span></span></span></div><div><span style="background-color: rgb(251, 250, 248);"><span style="background-color: rgb(251, 250, 248);"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">    什么是对象？</span></span></span></div><div><span style="background-color: rgb(251, 250, 248);"><span style="background-color: rgb(251, 250, 248);"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">    什么是收音机，对象是一个整体，对外提供一些操作。</span></span></span></div><div><span style="background-color: rgb(251, 250, 248);"><span style="background-color: rgb(251, 250, 248);"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">    </span></span></span></div><div><span style="background-color: rgb(251, 250, 248);"><span style="background-color: rgb(251, 250, 248);"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">    什么是面向对象开发？</span></span></span></div><div><span style="background-color: rgb(251, 250, 248);"><span style="background-color: rgb(251, 250, 248);"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">    就是在使用对象时，只关注对象提供的功能，不关注其内部细节。</span></span></span></div><div><span style="background-color: rgb(251, 250, 248);"><span style="background-color: rgb(251, 250, 248);"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">    比如，每次使用封装好的运动框架</span></span></span></div><div><br/></div><div><span style="background-color: rgb(251, 250, 248);"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">   </span><span style="background-color: rgb(251, 250, 248); font-size: 14px;">  </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(255, 38, 0); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">注意：面向对象是一种通用思想，并非只在程序中使用，任何事情都可以使用</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">－－－－公司老板分配任务</span></span></div><div><br/></div></div><div><br/></div><div><span style="font-size: 18px;">面向对象的特点</span></div><div style="box-sizing: border-box; padding: 8px; font-size: 12px; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902);"><div><br/></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">    封装：不考虑内部实现，只考虑功能实现</span></div><div><br/></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">    继承：从已有对象上，继承出新对象</span></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">    </span></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">    多态：多种形态，一个功能的多种不同应用场景</span></div><div><br/></div></div><div><br/></div><div><span style="font-size: 18px;">对象的组成</span></div><div style="box-sizing: border-box; padding: 8px; font-size: 12px; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902);"><div><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">    </span><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">方法（有归属）－－－－函数（自由的）</span></div><div><br/></div><div><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">    </span><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">属性（有归属）－－－－变量（自由的）</span></div></div><div><br/></div><div><br/></div><div><span style="font-size: 18px;"><span style="font-size: 18px; color: rgb(255, 38, 0);">OOA和OOD</span></span></div><div style="box-sizing: border-box; padding: 8px; font-size: 12px; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902);"><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">    OOA面向对象分析：</span></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">        人类起源：单细胞－－－－人，进化过程中，增加了各种器官，各个器官之间分工协作</span></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">        为什么统治世界的是人类？－－－－－精密的分工协作</span></div><div><br/></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">        大规模分工，精密协作</span></div><div><br/></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace; color: rgb(51, 51, 51);">   </span> <span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace; color: rgb(255, 0, 0); font-weight: bold;">面向对象分析：将大问题拆分成小问题，并试图用分工协作来完成的思维方式</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace; color: rgb(51, 51, 51);">。</span></span></div><div><br/></div><div><br/></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">    OOD面向对象设计：</span></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">        1.分析模块后，确定职责</span></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">            大哥招小弟－－端茶倒水，点烟捶背捏脚</span></div><div><br/></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">        2.确定耦合关系</span></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">            确定通信关系，如何交流，暗号</span></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">            弊端：当耦合达到一定程度时，如果换了一个助理，需要重新耦合，资源消耗太大</span></div><div><br/></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace; color: rgb(51, 51, 51);">           </span> <span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace; color: rgb(255, 0, 0); font-weight: bold;">高内聚低耦合</span></span></div><div><br/></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">        3.为OOP做准备</span></div><div><br/></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">        分析角色特性：</span></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">            讲师－－－－技术过硬</span></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">               －－－－讲课技能（口才）</span></div><div><br/></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">            销售－－－－沟通技巧（口才）</span></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">            </span></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">            找到角色共同特性－－－－继承</span></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">    </span></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">    </span></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">    对象如何被发明的？</span></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace; color: rgb(51, 51, 51);">       </span> <span style="background-color: rgb(251, 250, 248); font-size: 14px; font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace; color: rgb(255, 0, 0); font-weight: bold;">大量信息的处理和加工困难，打包之后，</span></span><span style="font-size: 14px; background-color: rgb(251, 250, 248);"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(255, 0, 0); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace; font-weight: bold;">将内容包含在其中。信息传递速度更快，效率更高</span></span></div><div><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">        </span></div><div><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">   </span><span style="font-size: 12px;" /><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(255, 0, 0); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace; font-weight: bold;">面向对象和面向</span><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(255, 0, 0); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace; font-weight: bold; line-height: 1.45;">过程的区别</span></div><div><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace; line-height: 1.45;">        面向对象－－先实现功能</span><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace; line-height: 1.45;">，再运行。分工协作，同时发生，解决问题。</span></div><div><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">        面向过程－－一边实现，一边运行。效率低下。</span></div><div><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">    </span></div><div><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">    面向对象并不是程序员发明的。在程序中我们叫面向对象（OO），在生活中叫分工协作。</span></div><div><br/></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">   </span><span style="font-size: 12px;" /><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(255, 38, 0); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">思考 &gt; 语法</span></div><div><br/></div></div><div><br/></div><div><span style="font-size: 18px;">构造函数的使用</span></div><div style="box-sizing: border-box; padding: 8px; font-size: 12px; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902);"><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">    当我们需要一套可以反复经过使用的，经过分类，代码设计经验的总结时，就用到了设计模式。</span></div><div style="text-align: center;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">   </span></div><div style="text-align: center;"><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;"> <img src="DAY16%EF%BC%9A%E9%9D%A2%E5%90%91%E5%AF%B9%E8%B1%A1%E7%BC%96%E7%A8%8B.resources/CE68FC92-D959-4B63-9D93-3066278A5895.png" height="306" width="400"/><br/></span></div></div><div style="text-align: center;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">    内功心法和武功招式</span></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">    </span></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">    设计模式：</span></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">        工厂模式：原料、加工、出厂</span></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">    </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(70, 99, 204); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">function</span><span style="font-size: 12px;" /><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(228, 139, 0); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">createPeople</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">(</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(181, 138, 0); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">name</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">,</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(181, 138, 0); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">age</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">,</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(181, 138, 0); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">like</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">){</span></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(70, 99, 204); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">            var</span><span style="font-size: 12px;" /><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">obj</span><span style="font-size: 12px;" /><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(105, 137, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">= new</span><span style="font-size: 12px;" /><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">Object();          </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(165, 178, 185); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">//原料</span></div><div><font style="font-size: 14px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">            obj.name = name<span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">;               </span><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(165, 178, 185); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">//加工</span></span></font></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">            obj.age</span><span style="font-size: 12px;" /><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(105, 137, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">=</span><span style="font-size: 12px;" /><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">age;</span></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">            obj.like</span><span style="font-size: 12px;" /><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(105, 137, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">=</span><span style="font-size: 12px;" /><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">like;</span></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">            obj.</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(228, 139, 0); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">show</span><span style="font-size: 12px;" /><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(105, 137, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">=</span><span style="font-size: 12px;" /><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(70, 99, 204); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">function</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">(){</span></div><div><font style="font-size: 14px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">                alert(</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(40, 156, 151); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">"我叫"</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(105, 137, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">+</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(70, 99, 204); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">this</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">.name</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(105, 137, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">+</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(40, 156, 151); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">",今年"</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(105, 137, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">+</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(70, 99, 204); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">this</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">.age</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(105, 137, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">+</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(40, 156, 151); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">"岁,喜欢"</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(105, 137, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">+</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(70, 99, 204); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">this</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">.like)</span></font></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">            };</span></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(105, 137, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">            return</span><span style="font-size: 12px;" /><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">obj;                     </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(165, 178, 185); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">//出厂</span></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">        }</span></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(70, 99, 204); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">        var</span><span style="font-size: 12px;" /><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">obj</span><span style="font-size: 12px;" /><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(105, 137, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">=</span><span style="font-size: 12px;" /><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">createPeople(</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(40, 156, 151); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">"AAA"</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">,</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(173, 66, 239); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">23</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">,</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(40, 156, 151); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">"LOL"</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">);</span></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(70, 99, 204); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">        var</span><span style="font-size: 12px;" /><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">obj2</span><span style="font-size: 12px;" /><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(105, 137, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">=</span><span style="font-size: 12px;" /><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">createPeople(</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(40, 156, 151); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">"BBB"</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">,</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(173, 66, 239); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">30</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">,</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(40, 156, 151); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">"JAVA"</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">);</span></div><div><br/></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">        obj.show();</span></div><div><font style="font-size: 14px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">        obj2.show();</span></font></div><div><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">    但是这种工厂模式已经被JS抛弃，</span></div><div><br/></div><div><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">    因为</span><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">JS内置了一种的工厂模式</span></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">    </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(70, 99, 204); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">function</span><span style="font-size: 12px;" /><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(228, 139, 0); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">CreatPeople</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">(</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(181, 138, 0); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">name</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">,</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(181, 138, 0); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">age</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">,</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(181, 138, 0); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">like</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">){</span></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(70, 99, 204); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">            this</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">.name</span><span style="font-size: 12px;" /><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(105, 137, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">=</span><span style="font-size: 12px;" /><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">name;</span></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(70, 99, 204); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">            this</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">.age</span><span style="font-size: 12px;" /><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(105, 137, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">=</span><span style="font-size: 12px;" /><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">age;</span></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(70, 99, 204); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">            this</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">.like</span><span style="font-size: 12px;" /><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(105, 137, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">=</span><span style="font-size: 12px;" /><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">like;</span></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(70, 99, 204); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">            this</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">.</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(228, 139, 0); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">show</span><span style="font-size: 12px;" /><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(105, 137, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">=</span><span style="font-size: 12px;" /><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(70, 99, 204); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">function</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">(){</span></div><div><font style="font-size: 14px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">                alert(</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(40, 156, 151); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">"我叫"</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(105, 137, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">+</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(70, 99, 204); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">this</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">.name</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(105, 137, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">+</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(40, 156, 151); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">",今年"</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(105, 137, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">+</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(70, 99, 204); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">this</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">.age</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(105, 137, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">+</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(40, 156, 151); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">"岁,喜欢"</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(105, 137, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">+</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(70, 99, 204); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">this</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">.like);</span></font></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">            }</span></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">        }</span></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(70, 99, 204); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">        var</span><span style="font-size: 12px;" /><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">obj</span><span style="font-size: 12px;" /><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(105, 137, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">= new</span><span style="font-size: 12px;" /><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">CreatPeople(</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(40, 156, 151); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">"ABC"</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">,</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(173, 66, 239); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">20</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">,</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(40, 156, 151); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">"PHP"</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">);</span></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(70, 99, 204); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">        var</span><span style="font-size: 12px;" /><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">obj2</span><span style="font-size: 12px;" /><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(105, 137, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">= new</span><span style="font-size: 12px;" /><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">CreatPeople(</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(40, 156, 151); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">"QWE"</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">,</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(173, 66, 239); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">32</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">,</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(40, 156, 151); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">"Python"</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">);</span></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">        obj.show();</span></div><div><font style="font-size: 14px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">        obj2.show();</span></font></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">    JS内置的工厂模式比传统的工厂模式更高效，复用性更强。</span></div><div><br/></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">    JS内置的工厂模式</span><span style="font-size: 14px; background-color: rgb(251, 250, 248);"><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(51, 51, 51); font-family: Monaco;">叫</span><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(227, 0, 0); font-family: Monaco; font-weight: bold;">构造函数</span><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(51, 51, 51); font-family: Monaco;">。</span></span></div><div><br/></div></div><div><br/></div><div><span style="font-size: 18px;">构造函数和对象的关系</span></div><div style="box-sizing: border-box; padding: 8px; font-size: 12px; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902);"><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">    面向对象－－－－对一个对象进行编程</span></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">    构造函数－－－－提供一个对象供你编程</span></div><div><br/></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">    通过构造函数，实现面向对象编程</span></div></div><div><br/></div><div><span style="font-size: 18px;">使用Json创建对象</span></div><div style="box-sizing: border-box; padding: 8px; font-size: 12px; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902);"><div><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">    </span><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(70, 99, 204); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">var</span><span style="font-size: 12px;" /><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(6, 6, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">obj</span><span style="font-size: 12px;" /><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(105, 137, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">=</span><span style="font-size: 12px;" /><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(6, 6, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">{</span></div><div><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(6, 6, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">    </span><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(6, 6, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">    </span><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(6, 6, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">name</span><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(79, 93, 102); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">:</span><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(40, 156, 151); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">"admin"</span><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(6, 6, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">,</span></div><div><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(6, 6, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">    </span><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(6, 6, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">    </span><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(6, 6, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">age</span><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(79, 93, 102); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">:</span><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(173, 66, 239); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">23</span><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(6, 6, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">,</span></div><div><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(6, 6, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">    </span><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(6, 6, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">    </span><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(6, 6, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">like</span><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(79, 93, 102); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">:</span><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(40, 156, 151); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">"LOL"</span><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(6, 6, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">,</span></div><div><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(6, 6, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">    </span><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(6, 6, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">    </span><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(6, 6, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">show</span><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(79, 93, 102); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">:</span><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(70, 99, 204); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">function</span><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(6, 6, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">(){</span></div><div><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(6, 6, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">    </span><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(6, 6, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">    </span><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(6, 6, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">    </span><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(6, 6, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">alert(</span><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(40, 156, 151); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">"我叫"</span><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(105, 137, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">+</span><span style="background-color: rgb(251, 250, 248); font-size: 12px;">this.name</span><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(105, 137, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">+</span><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(40, 156, 151); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">",今年"</span><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(105, 137, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">+</span><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(6, 6, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">this.age</span><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(105, 137, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">+</span><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(40, 156, 151); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">"岁,喜欢"</span><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(105, 137, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">+this</span><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(6, 6, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">.like)</span></div><div><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(6, 6, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">    </span><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(6, 6, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">    </span><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(6, 6, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">}</span></div><div><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(6, 6, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">    </span><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(6, 6, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">}</span></div><div><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(6, 6, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">    </span><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(6, 6, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">obj.show()</span></div></div><div><br/></div><div><span style="font-size: 18px;">使用构造函数创建对象</span></div><div style="box-sizing: border-box; padding: 8px; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902);"><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">        </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(70, 99, 204); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">fun</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(70, 99, 204); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">ction</span> <span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(228, 139, 0); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">CreatPeople</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">(</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(181, 138, 0); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">name</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">,</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(181, 138, 0); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">age</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">,</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(181, 138, 0); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">like</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">){</span></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(70, 99, 204); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">            this</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">.name</span> <span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(105, 137, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">=</span> <span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">name;</span></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(70, 99, 204); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;"> </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(70, 99, 204); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">    </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(70, 99, 204); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">   </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(70, 99, 204); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">    </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(70, 99, 204); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">this</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">.age</span> <span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(105, 137, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">=</span> <span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">age;</span></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(70, 99, 204); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">    </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(70, 99, 204); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">    </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(70, 99, 204); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">    </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(70, 99, 204); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">this</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">.like</span> <span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(105, 137, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">=</span> <span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">like;</span></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(70, 99, 204); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">    </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(70, 99, 204); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">    </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(70, 99, 204); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">    </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(70, 99, 204); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">this</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">.</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(228, 139, 0); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">show</span> <span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(105, 137, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">=</span> <span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(70, 99, 204); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">function</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">(){</span></div><div><font style="font-size: 14px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">    </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">    </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">    </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">    </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">alert(</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(40, 156, 151); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">"我叫"</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(105, 137, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">+</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(70, 99, 204); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">this</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">.name</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(105, 137, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">+</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(40, 156, 151); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">",今年"</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(105, 137, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">+</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(70, 99, 204); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">this</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">.age</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(105, 137, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">+</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(40, 156, 151); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">"岁,喜欢"</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(105, 137, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">+</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(70, 99, 204); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">this</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">.like);</span></font></div><div><font style="font-size: 14px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">    </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;"> </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">    </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">   </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">}</span></font></div><div><font style="font-size: 14px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">    </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">    </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">}</span></font></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(70, 99, 204); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">    </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(70, 99, 204); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">    </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(70, 99, 204); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">var</span> <span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">obj</span> <span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(105, 137, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">= new</span> <span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">CreatPeople(</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(40, 156, 151); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">"ABC"</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">,</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(173, 66, 239); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">20</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">,</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(40, 156, 151); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">"PHP"</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">);</span></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(70, 99, 204); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">    </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(70, 99, 204); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">    </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(70, 99, 204); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">var</span> <span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">obj2</span> <span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(105, 137, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">= new</span> <span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">CreatPeople(</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(40, 156, 151); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">"QWE"</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">,</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(173, 66, 239); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">32</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">,</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(40, 156, 151); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">"Python"</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">);</span></div><div><font style="font-size: 14px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">    </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">    </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">obj.show();</span></font></div><div><br/></div><div><font style="font-size: 14px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">    </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">    </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">obj2.show();</span></font></div></div><div><br/></div><div><br/></div><div><br/></div><div><br/></div><div><span style="font-size: 18px;">1.掌握面相对象编程的好处</span></div><div><br/></div><div><span style="font-size: 18px;">2.轮播图</span><span style="font-size: 18px;">面向对象改造</span></div><div><br/></div><div><br/></div><div><br/></div><div><span style="font-size: 18px;">原型的概念</span></div><div style="box-sizing: border-box; padding: 8px; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902);"><div style="font-size: 12px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">    在对象中，两个新创建的函数，是不相等的：</span></div><div style="font-size: 12px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">    </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(70, 99, 204); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">var</span><span style="font-size: 12px;" /><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">obj1</span><span style="font-size: 12px;" /><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(105, 137, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">=</span><span style="font-size: 12px;" /><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">{</span></div><div style="font-size: 12px;"><font style="font-size: 14px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">        fn</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(79, 93, 102); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">:</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(70, 99, 204); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">function</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">(){</span></font></div><div style="font-size: 12px;"><font style="font-size: 14px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">            alert(</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(173, 66, 239); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">1</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">);</span></font></div><div style="font-size: 12px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">        }</span></div><div style="font-size: 12px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">    }</span></div><div style="font-size: 12px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(70, 99, 204); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">    var</span><span style="font-size: 12px;" /><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">obj2</span><span style="font-size: 12px;" /><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(105, 137, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">=</span><span style="font-size: 12px;" /><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">{</span></div><div style="font-size: 12px;"><font style="font-size: 14px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">        fn</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(79, 93, 102); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">:</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(70, 99, 204); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">function</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">(){</span></font></div><div style="font-size: 12px;"><font style="font-size: 14px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">            alert(</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(173, 66, 239); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">1</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">);</span></font></div><div style="font-size: 12px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">        }</span></div><div style="font-size: 12px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">    }</span></div><div style="font-size: 12px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(74, 138, 1); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">    console</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">.log(obj1.fn </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(105, 137, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">==</span><span style="font-size: 12px;" /><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">obj2.fn);    </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(165, 178, 185); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">//false</span></div><div style="font-size: 12px;"><br/></div><div style="font-size: 12px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">    在构造函数中，同样属于两个新创建的函数，也是不相等的</span></div><div style="font-size: 12px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">    </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(70, 99, 204); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">function</span><span style="font-size: 12px;" /><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(228, 139, 0); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">Fn</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">(</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(181, 138, 0); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">name</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">){</span></div><div style="font-size: 12px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(70, 99, 204); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">        this</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">.name</span><span style="font-size: 12px;" /><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(105, 137, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">=</span><span style="font-size: 12px;" /><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">name;</span></div><div style="font-size: 12px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(70, 99, 204); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">        this</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">.</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(228, 139, 0); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">show</span><span style="font-size: 12px;" /><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(105, 137, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">=</span><span style="font-size: 12px;" /><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(70, 99, 204); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">function</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">(){</span></div><div style="font-size: 12px;"><font style="font-size: 14px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">            alert(</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(70, 99, 204); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">this</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">.name);</span></font></div><div style="font-size: 12px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">        }</span></div><div style="font-size: 12px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">    }</span></div><div style="font-size: 12px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(70, 99, 204); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">    var</span><span style="font-size: 12px;" /><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">obj1</span><span style="font-size: 12px;" /><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(105, 137, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">= new</span><span style="font-size: 12px;" /><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">Fn(</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(40, 156, 151); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">"AAA"</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">);</span></div><div style="font-size: 12px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(70, 99, 204); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">    var</span><span style="font-size: 12px;" /><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">obj2</span><span style="font-size: 12px;" /><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(105, 137, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">= new</span><span style="font-size: 12px;" /><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">Fn(</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(40, 156, 151); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">"BBB"</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">);</span></div><div style="font-size: 12px;"><font style="font-size: 14px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(74, 138, 1); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">    console</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">.log(obj1.show</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(105, 137, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">==</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">obj2.show);        </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(165, 178, 185); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">//false</span></font></div><div style="font-size: 12px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">    </span></div><div style="font-size: 12px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">    此时可以看出构造函数的多次创建会产生多个同名函数，造成冗余太多。</span></div><div style="font-size: 12px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">    </span></div><div style="font-size: 12px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">    利用原型prototype解决。</span></div><div style="font-size: 12px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">    </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(70, 99, 204); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">function</span><span style="font-size: 12px;" /><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(228, 139, 0); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">Fn</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">(){</span><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(6, 6, 6); font-family: Monaco;">}</span></div><div style="font-size: 12px;"><font style="font-size: 14px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(165, 178, 185); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">    <span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(74, 138, 1); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">console</span><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">.log(Fn.prototype);</span></span></font></div><div style="font-size: 12px;"><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(165, 178, 185); font-family: Monaco; font-variant-caps: normal; font-variant-ligatures: normal; line-height: normal;">    </span><font style="font-size: 14px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(165, 178, 185); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">//</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(165, 178, 185); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">constructor表示当前的函数属于谁</span></font></div><div style="font-size: 12px;"><font style="font-size: 14px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(165, 178, 185); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">    //</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(165, 178, 185); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">__proto__  &lt;==&gt;  [[prototype]]，书面用语，表示原型链</span></font></div><div style="font-size: 12px;"><br/></div><div style="font-size: 12px;"><br/></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(165, 178, 185); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">    </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(70, 99, 204); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">var</span> <span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">fn1</span> <span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(105, 137, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">= new</span> <span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">Object();</span></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(70, 99, 204); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">    var</span> <span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">fn2</span> <span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(105, 137, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">= new</span> <span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">Object();</span></div><div><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">  </span> <span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;"> Object.prototype.</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(228, 139, 0); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">show</span> <span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(105, 137, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">=</span> <span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(70, 99, 204); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">function</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">(){</span></div><div><font style="font-size: 14px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">        alert(</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(173, 66, 239); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">1</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">);</span></font></div><div><span style="background-color: rgb(251, 250, 248);"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">    }</span></span></div><div><font style="font-size: 14px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(74, 138, 1); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">    </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(74, 138, 1); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">con</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(74, 138, 1); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">sole</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">.log(fn1.show</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(105, 137, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">==</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(6, 6, 6); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">fn2.show);     </span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(165, 178, 185); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">//tu</span><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(165, 178, 185); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; line-height: normal;">re</span></font></div><div style="font-size: 12px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">    </span></div><div style="font-size: 12px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">    此时，任何一个对象的原型上都有了show方法，由此得出，Object.prototype身上的添加的方法，相当于添加到了所有的Object身上。</span></div><div style="font-size: 12px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">    </span></div><div style="font-size: 12px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px;"><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">    为了解决构造函数的冗余问题，我们将</span><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(227, 0, 0); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace; font-weight: bold;">属性写在构造函数内，方法写在原型中</span><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">。这是面向对象的编程格式之一。</span></span></div><div style="font-size: 12px;"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">    面向对象的编程格式之一：</span></div><div><span style="font-size: 14px; background-color: rgb(251, 250, 248); color: rgb(255, 38, 0); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">       </span> <span style="background-color: rgb(251, 250, 248);"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(255, 38, 0); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace; font-weight: bold;">1.属性写在构造函数内；</span></span></div><div><span style="background-color: rgb(251, 250, 248);"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(255, 38, 0); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">       </span> <span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(255, 38, 0); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace; font-weight: bold;">2.方法写在原型中</span></span></div><div><span style="background-color: rgb(251, 250, 248);"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(255, 38, 0); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">       </span> <span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(255, 38, 0); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace; font-weight: bold;">3.构造函数中的this指向当前new出来的对象</span></span></div><div><span style="background-color: rgb(251, 250, 248);"><span style="background-color: rgb(251, 250, 248);"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(255, 38, 0); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace; font-weight: bold;">       4.原型方法中的this指向当前原型所属的函数被new出来的对象</span></span></span></div><div><span style="background-color: rgb(251, 250, 248);"><span style="background-color: rgb(251, 250, 248); font-size: 14px; color: rgb(51, 51, 51); font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace;">    </span></span></div></div><div><br/></div><div><br/></div><div><img src="DAY16%EF%BC%9A%E9%9D%A2%E5%90%91%E5%AF%B9%E8%B1%A1%E7%BC%96%E7%A8%8B.resources/640.png" height="230" width="392"/><br/></div><div><br/></div><div><span style="font-size: 18px;">1.面向对象选项卡</span></div><div><br/></div><div><br/></div><div><span style="font-size: 18px;">2.烟花效果案例</span></div><div><br/></div><div><a href="DAY16%EF%BC%9A%E9%9D%A2%E5%90%91%E5%AF%B9%E8%B1%A1%E7%BC%96%E7%A8%8B.resources/8_%E7%83%9F%E8%8A%B1-%E9%AB%98%E7%BA%A7%E7%89%88.html">8_烟花-高级版.html</a></div><div><br/></div><div><br/></div><div><br/></div><div style="text-align: center;"><div><img src="DAY16%EF%BC%9A%E9%9D%A2%E5%90%91%E5%AF%B9%E8%B1%A1%E7%BC%96%E7%A8%8B.resources/2ADD4F13-EC1A-4CF7-9FD0-95D255C41429.png" height="482" width="527"/><br/></div></div><div><br/></div><div><br/></div><div><a href="DAY16%EF%BC%9A%E9%9D%A2%E5%90%91%E5%AF%B9%E8%B1%A1%E7%BC%96%E7%A8%8B.resources/%E8%B4%AA%E5%90%83%E8%9B%87.html">贪吃蛇.html</a></div><div><br/></div><div><br/></div><div><br/></div><div><br/></div><div><br/></div></body></html>